#define  _CRT_SECURE_NO_WARNINGS  1
#include <stdio.h>
#include <string.h>
int main()
{
	char a[100], b[100];
	gets(a);
	gets(b);
	int i = 0, j = 0;
	char max = b[0];
	for (i = 0; b[i] != '\0'; i++)
	{
		if (b[i] > max)
			max = b[i];
	}
	char min = a[0];
	for (i = 0; a[i] != '\0'; i++)
	{
		if (a[i] < min)
			j = i;
	}
	int len = strlen(a) - 1;
	char c[100];
	for (i = 0; i < len + 2; i++)
	{
		if (i <= j)
		{
			c[i] = a[i];
		}
		else if(i == j + 1)
		{
			c[i] = max;
		}
		else
		{
			c[i] = a[i - 1];
		}
	}
	c[i] = '\0';
	printf("%s", c);

	return 0;
}